<?php 
session_start();
include("include/config.php");
$validate_array=array("Hue6543","KKud645","Rayvalidate","noobskoolcheck");
$cmsArr = mysql_fetch_array(mysql_query("select * from ".TABLEPREFIX."_cms where cms_id='17'"));

if(isset($_REQUEST['sub_val'])){
	if(in_array($_REQUEST['chk_val'],$validate_array)){
		$_SESSION['VALIDATE']=1; 
		header("location:".SITE_URL);
	}
	else
	  $Msg = '<span style="color:#FF0000; padding-left:20px;">Wrong Beta Key</span>';
}

if(isset($_REQUEST['sub_mail'])){
	$sql="select admin_email from ".TABLEPREFIX."_admin where is_active='Y'";	
	$qry=mysql_query($sql);
	if(mysql_num_rows($qry)==0)
	{
		echo "<script>alert('No Admin email ID was selected.');</script>";
	}
	else
	{
		$mail=mysql_fetch_array($qry);
		$to = $mail['admin_email'];
		$subject = "Mail to Admin";
		$message = "Hello Admin!<br>An user with email address ".$_REQUEST['mail_id']."has been subscribed for noobskool updates";
		$from = $_REQUEST['mail_id'];
		$headers = "From:" . $from;
		mail($to,$subject,$message,$headers);
		$Msg1 = '<span style="color:#009933;padding-left:20px;">Mail Sent Successfuly</span>';
	}
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="<?php echo $cmsArr['metatag_keywords']?>">  
<meta name="description" content="<?php echo $cmsArr['metatag_description']?>">
<title><?php echo $cmsArr['metatag_title']?></title>
<link type="text/css" rel="stylesheet" href="style/validate.css" />
<script type="text/javascript">
function checkMailValid()
{
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.getElementById('mail_id').value;
   if(reg.test(address) == false) {
      alert('Invalid Email Address');
      return false;
   }
}
function checkEmpty()
{   
  var bkey = document.getElementById('chk_val').value;
  if(bkey == ''){
    alert('Please enter Beta Key');
    return false;
  }
}
</script>

</head>

<body>
<div class="main">
<div class="header">
<div class="social-links">
<div class="facebook" title="facebook"><a href="http://www.facebook.com/pages/NOOBSKOOL/271843409518451" target="_blank"></a></div>
<div class="twitter" title="twitter"><a href="https://twitter.com/#!/NOOBSKOOL" target="_blank"></a></div>
</div>

<div class="logo_a"><img src="images/logo.gif" width="204" height="64" border="0" /></div>
<div class="site">Site is Under Maintenance</div>
<div class="paragarph">
<p><?php echo html_entity_decode($cmsArr['cms_description']);?>
</p>
 <div class="clear"></div>
</div>
<div class="box">
<div class="box_a">
<div class="box_a_heading">Beta Key </div>
<p>Please Enter Beta Key to acess NOOBSKOOL</p>
<form action="" method="post" class="maintan" onsubmit="return checkEmpty();">
<input name="chk_val" id="chk_val" type="text"  value="" class="text"/>
<input name="sub_val" id="sub_val" type="submit" value="Submit" class="sub"/>
<?php if($Msg!='') echo $Msg; ?>
</form>
</div>

<div class="box_a">
<div class="box_a_heading">Email Address </div>
<p>We will send you the Updates when the site open to Public</p>
<form name="frm_mail" id="frm_mail" action="" method="post" class="maintan" onsubmit="return checkMailValid();">
<input  name="mail_id" id="mail_id" type="text" value="" class="text" />
<input name="sub_mail" id="sub_mail" type="submit" value="Submit" class="sub"/>
<?php if($Msg1!='') echo $Msg1; ?>

</form>
</div>
<div class="clear"></div>
</div>
   
  </div>
  <div class="clear"></div>


<div class="push"></div>
 <div class="clear"></div>
</div>
<br/>	<br/>	<br/>	<br/>	
<div class="footer" style="margin-top:50px;">
   <div class="footer-inner">
      <div class="footer-left">&copy; 2012 Noobskool. All rights reserved.</div>
      <div class="footer-right">
       
      </div>
   </div>
</div>	

</body></html>